package co.fitstart.admin.service;

import java.math.BigDecimal;
import java.util.List;
import com.demo2do.core.support.Page;
import co.fitstart.admin.entity.search.AllOrderSearch;
import co.fitstart.admin.entity.search.OrderSearch;
import co.fitstart.entity.coupon.Coupon;
import co.fitstart.entity.finance.InvoiceExportRecord;
import co.fitstart.entity.finance.OrderInvoiceRecord;
import co.fitstart.entity.finance.PaidType;
import co.fitstart.entity.finance.Receipt;
import co.fitstart.entity.finance.ReceiptExportRecord;
import co.fitstart.entity.finance.ReceiptType;
import co.fitstart.entity.finance.SalesOrderExportRecord;
import co.fitstart.entity.order.Order;
import co.fitstart.entity.order.OrderPriceType;
import co.fitstart.entity.order.OrderStatus;
import co.fitstart.entity.order.OrderType;
import co.fitstart.entity.order.PaymentMethod;
import co.fitstart.entity.order.PaymentStatus;
import co.fitstart.entity.order.RefundMethod;
import co.fitstart.entity.principal.Principal;
import co.fitstart.entity.product.Product;
import co.fitstart.entity.reference.Contact;
import co.fitstart.entity.site.Site;

/**
 * 
 * @author jiecheng
 *
 */
public interface OrderService extends DataService<Order> {

    /**
     * List order by status and page
     * 
     * @param orderType
     * @param orderStatus
     * @param page
     * @return
     */
    public List<Order> listByPage(OrderType orderType, String orderStatus, Page page);
    
    /**
     * List individual order by experience, status and page
     * 
     * @param experience
     * @param give
     * @param orderStatus
     * @param page
     * @return
     */
    public List<Order> listByPage(boolean experience, boolean give, String orderStatus, Page page);
    
    /**
     * @param site
     * @param orderType
     * @param orderStatus
     * @param page
     * @return
     */
    public List<Order> listByPage(Site site, OrderType orderType, String orderStatus, Page page);
    
    /**
     * 
     * @param sites
     * @param orderType
     * @param orderStatus
     * @param page
     * @return
     */
    public List<Order> listByPage(List<Site> sites, OrderType orderType, String orderStatus, Page page);

    /**
     * 
     * @param site
     * @param experience
     * @param give
     * @param orderStatus
     * @param page
     * @return
     */
    public List<Order> listByPage(Site site, boolean experience, boolean give, String orderStatus, Page page);

    /**
     * 
     * @param sites
     * @param experience
     * @param give
     * @param orderStatus
     * @param page
     * @return
     */
    public List<Order> listByPage(List<Site> sites, boolean experience, boolean give, String orderStatus, Page page);

    /**
     * 
     * @param product
     * @return
     */
    public List<Order> list(Product product);

    /**
     * 
     * @param exportSale
     * @param payOffer
     * @param paymentStatus
     * @param page
     * @return
     */
    public List<Order> list(boolean exportSale, boolean payOffer, PaymentStatus[] paymentStatus, Page page);

    /**
     * 
     * @param exportReceipt
     * @param paymentStatus
     * @param page
     * @return
     */
    public List<Order> list(boolean exportReceipt, PaymentStatus[] paymentStatus, Page page);

    /**
     * 
     * @param payOffer
     * @param paymentStatus
     * @param city
     * @return
     */
    public List<Order> list(boolean payOffer, PaymentStatus[] paymentStatus, String city);

    /**
     * 
     * @param paymentStatus
     * @return
     */
    public List<Order> list(PaymentStatus[] paymentStatus);

    /**
     * 
     * @param id
     * @return
     */
    public Order loadOrder(Long id);

    /**
     * 
     * @param product
     * @param contact
     * @param paymentMethod
     * @return
     */
    public Order createOnline(Product product, Contact contact, PaymentMethod paymentMethod);

    /**
     * 
     * @param order
     */
    public void editOrder(Order order);

    /**
     * 
     * @param order
     * @param type
     * @param orderPriceRemarks
     */
    public void editOrderPrice(Order order, OrderPriceType type, String orderPriceRemarks);

    /**
     * 
     * @param orderSearch
     * @param page
     * @return
     */
    public List<Order> search(OrderSearch orderSearch, Page page);

    /**
     * 
     * @param orderSearch
     * @param page
     * @return
     */
    public List<Order> search(AllOrderSearch orderSearch, Page page);

    /**
     * 
     * @param orderType
     * @param orderStatus
     * @param orderId
     * @param page
     * @return
     */
    public List<Order> search(OrderType orderType, OrderStatus orderStatus, Long orderId, Page page);

    /**
     * 
     * @param experience
     * @param give
     * @param orderStatus
     * @param orderId
     * @param page
     * @return
     */
    public List<Order> search(boolean experience, boolean give, OrderStatus orderStatus, Long orderId, Page page);

    /**
     * 
     * @param orderSearch
     * @return
     */
    public List<Order> exportOrder(OrderSearch orderSearch);

    /**
     * 
     * @param orderSearch
     * @return
     */
    public int totalOrder(OrderSearch orderSearch);

    /**
     * 
     * @param allorderSearch
     * @return
     */
    public int totalOrder(AllOrderSearch allorderSearch);

    /**
     * 
     * @param order
     * @param orderStatus
     * @param paymentStatus
     */
    public void changeStatus(Order order, OrderStatus orderStatus, PaymentStatus paymentStatus);

    /**
     * 
     * @param order
     * @param expressageCompany
     * @param expressageNumber
     */
    public void ship(Order order, String expressageCompany, String expressageNumber);

    /**
     * @param order
     */
    public void close(Order order);

    /**
     * 
     * @param order
     * @param refundPrice
     * @param refundMethod
     * @param refoundRemarks
     */
    public void refundOrder(Order order, BigDecimal refundPrice, RefundMethod refundMethod, String refoundRemarks);

    /**
     * 
     * @param order
     * @param salesman
     */
    public void changeSalesman(Order order, Principal salesman);

    /**
     * 
     * @param product
     * @param mobile
     * @param name
     * @param site
     * @return
     */
    public Order createExperienceOrder(Product product, String mobile, String name, Site site, Long userSourceType);

    /**
     * 
     * @param orderInvoiceRecord
     * @param order
     * @param operator
     */
    public void invoice(OrderInvoiceRecord orderInvoiceRecord, Order order, Long operator);

    /**
     * 
     * @param orderIds
     * @param operator
     */
    public void exportSales(List<Long> orderIds, Long operator);

    /**
     * 
     * @param orderIds
     * @param type
     * @param operator
     */
    public void exportReceipt(List<Long> orderIds, ReceiptType type, Long operator);

    /**
     * 
     * @param page
     * @return
     */
    public List<SalesOrderExportRecord> listSalesOrderExportRecord(Page page);

    /**
     * 
     * @param page
     * @return
     */
    public List<ReceiptExportRecord> listReceiptExportRecord(Page page);

    /**
     * 
     * @param invoice
     * @param export
     * @param page
     * @return
     */
    public List<OrderInvoiceRecord> listOrderInvoiceRecord(boolean invoice, boolean export, Page page);

    /**
     * 
     * @return
     */
    public List<OrderInvoiceRecord> listOrderInvoiceRecord();

    /**
     * 
     * @param invoiceRecordIds
     * @param operator
     */
    public void exportInvoiceRecord(List<Long> invoiceRecordIds, Long operator);

    /**
     * 
     * @param page
     * @return
     */
    public List<InvoiceExportRecord> listInvoiceExportRecord(Page page);

    /**
     * 
     * @param order
     * @param orderNumber
     */
    public void editOrderNumber(Order order, String orderNumber);

    /**
     * 
     * @param order
     * @param deposit
     */
    public void deposit(Order order, BigDecimal deposit, PaymentMethod paymentMethod);

    /**
     * 
     * @param order
     * @param offer
     * @param paymentMethod
     */
    public void offer(Order order, BigDecimal offer, PaymentMethod paymentMethod);

    /**
     * 
     * @param order
     * @param balance
     * @param paymentMethod
     */
    public void payBalance(Order order, BigDecimal balance, PaymentMethod paymentMethod);

    /**
     * 
     * @param paidType
     * @param export
     * @param page
     * @return
     */
    public List<Receipt> listReceipt(PaidType paidType, boolean export, Page page);

    /**
     * 
     * @param paidType
     * @param export
     * @return
     */
    public List<Receipt> listReceipt(PaidType paidType, boolean export);

    /**
     * 
     * @param receiptIds
     * @param receiptType
     * @param operator
     */
    public void exportSaleReceipt(List<Long> receiptIds, ReceiptType receiptType, Long operator);

    /**
     * 
     * @param orderNumber
     * @return
     */
    public Long getOrderId(String orderNumber);

    /**
     * 
     * @param expUserMobile
     */
    public void validateUserExperienceCount(Product product, String expUserMobile);
    
    /**
     * 
     * @param order
     * @param userName
     */
    public void editUserName(Order order, String userName);
    
    /**
     * 
     * @param order
     * @param mobile
     */
    public void editMobile(Order order, String mobile);
    
    /**
     * 
     * @param order
     * @return
     */
    public List<Receipt> listReceipt(Order order);
    
    /**
     * 
     * @param mobile
     * @param product
     * @param site
     * @return
     */
    public Order createGive(String mobile, String name, Product product, Site site, Long userSourceType);
    
    /**
     * 
     * @param mobile
     * @param name
     * @param product
     * @param site
     * @param userSourceType
     * @return
     */
    public Order createExperience(String mobile, String name, Product product, Site site, Long userSourceType);
    
    /**
     * 
     * @param mobile
     * @param name
     * @param product
     * @param site
     * @param coupon
     * @param userSourceType
     * @param courseAttr
     * @return
     */
    public Order createOrderIn(String mobile, String name, Product product, Site site, Coupon coupon, Long userSourceType, String courseAttr);
    
    /**
     * 
     * @param mobile
     * @param name
     * @param product
     * @param site
     * @param coupon
     * @param userSourceType
     * @return
     */
    public Order createOrderYear(String mobile, String name, Product product, Site site, Coupon coupon, Long userSourceType);
    
    /**
     * 
     * @param mobile
     * @param name
     * @param product
     * @param site
     * @param coupon
     * @param userSourceType
     * @return
     */
    public Order createOrderCard(String mobile, String name, Product product, Site site, Coupon coupon, Long userSourceType);
}
